/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package serveur;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
 *
 * @author ju
 */
public class CpuImpl  extends UnicastRemoteObject  implements shared.Cpu{
    private static CpuImpl instance;
    private static Object mutex= new Object();
    private double us;
    private double sy;
    private double ni;
    private double id;
    private double wa;
    private double hi;
    private double si;
    private double st;
    private double loa1;
    private double loa5;
    private double loa15;

    @Override
    public double getLoa1() {
        return loa1;
    }

    public void setLoa1(int loa1) {
        this.loa1 = loa1;
    }

    @Override
    public double getLoa5() {
        return loa5;
    }

    public void setLoa5(int loa5) {
        this.loa5 = loa5;
    }

    @Override
    public double getLoa15() {
        return loa15;
    }

    public void setLoa15(int loa15) {
        this.loa15 = loa15;
    }

    private CpuImpl() throws RemoteException  {
        hi=1.0;
        sy=1.0;
        ni=1.0;
        id=1.0;
        wa=1.0;
        us=1.0;
        si=1.0;
        st=1.0;
        loa1=1.0;
        loa15=1.0;
        loa15=1.0;
        
      
    }

     public static CpuImpl getInstance()  throws RemoteException {
         if (null == instance) { // Premier appel
            synchronized (mutex) {
                if (null == instance) {
                    instance = new CpuImpl();
                }
            }
        }
        return instance;
    
    }     

     
 

    @Override
    public double getUs() {
        return us;
    }

    
    public void setUs(double us) {
        this.us = us;
    }

    @Override
    public double getSy() {
        return sy;
    }

    public void setSy(double sy) {
        this.sy = sy;
    }

    @Override
    public double getNi() {
        return ni;
    }

   
    public void setNi(double ni) {
        this.ni = ni;
    }

    @Override
    public double getId() {
        return id;
    }

   
    public void setId(double id) {
        this.id = id;
    }

    @Override
    public double getWa() {
        return wa;
    }

    
    public void setWa(double wa) {
        this.wa = wa;
    }

    @Override
    public double getHi() {
        return hi;
    }

   
    public void setHi(double hi) {
        this.hi = hi;
    }

    @Override
    public double getSi() {
        return si;
    }

   
    public void setSi(double si) {
        this.si = si;
    }

    @Override
    public double getSt() {
        return st;
    }

    
    public void setSt(double st) {
        this.st = st;
    }

    @Override
    public String toString() {
        return us+" "+sy+" "+st+" "+si; 
    }
 
   
}
